package com.uzai.console.dto.device;

import com.uzai.console.common.utils.DateUtil;
import com.uzai.console.dto.QueryParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

/**
 * @author liuqi
 * @date 2021年08月26日 14:31
 */
@ApiModel("机器人分页也列表查询参数")
public class DeviceQuery extends QueryParam {

    @ApiModelProperty("个人微信：private_wechat； 企业微信：work_wechat； 公众号：wx_pub")
    private String deviceType;

    @ApiModelProperty("机器人ID/昵称/备注")
    private String keyword;

    @ApiModelProperty("配置ID")
    private Long configId;

    @ApiModelProperty("查询类型(0-查询已经到期；1-查询未到期；2-查询即将到期（7天内)；3-查询即将到期（15天内)；4-查询即将到期（30天内)")
    private Integer expireType;

    @ApiModelProperty("查询开始到期时间")
    private Integer expireTimeStart;

    @ApiModelProperty("查询开始到期时间")
    private Integer expireTimeEnd;

    public String getDeviceType() {
        return deviceType;
    }

    public void setDeviceType(String deviceType) {
        this.deviceType = deviceType;
    }

    @Override
    public String getKeyword() {
        return keyword;
    }

    @Override
    public void setKeyword(String keyword) {
        this.keyword = keyword;
    }

    public Long getConfigId() {
        return configId;
    }

    public void setConfigId(Long configId) {
        this.configId = configId;
    }

    public Integer getExpireType() {
        return expireType;
    }

    public void setExpireType(Integer expireType) {
        this.expireType = expireType;
    }

    public Integer getExpireTimeStart() {
        if(expireTimeStart == null){
            expireTimeStart = DateUtil.getNowTime();
        }
        return expireTimeStart;
    }

    public void setExpireTimeStart(Integer expireTimeStart) {
        this.expireTimeStart = expireTimeStart;
    }

    public Integer getExpireTimeEnd() {
        if(expireType != null){
            if(expireType.intValue() == 0){
                expireTimeEnd = getExpireTimeStart();
            }else if(expireType.intValue() == 1){
                expireTimeEnd = getExpireTimeStart();
            }else if (expireType.intValue() == 2){
                expireTimeEnd = getExpireTimeStart() + 604800;
            }else if (expireType.intValue() == 3){
                expireTimeEnd = getExpireTimeStart() + 1296000;
            }else if (expireType.intValue() == 4){
                expireTimeEnd = getExpireTimeStart() + 2592000;
            }
        }
        return expireTimeEnd;
    }

    public void setExpireTimeEnd(Integer expireTimeEnd) {
        this.expireTimeEnd = expireTimeEnd;
    }
}
